package com.dyw.Day04;

/**
 * @auther Devil
 * @create 2022-01-10-22:33
 */

/**
 * 两数之和
 */
public class Demo01 {

    public int[] twoSum(int[] nums, int target) {
        int n = nums.length-1;
        int[] num=new int[2];
        for (int i = 0; i < n-1; i++) {
            for(int j=i+1; j<n;j++){
                if(nums[i]+nums[j] == target){
                    num[0] = i;
                    num[1] = j;
                    return num;
                }
            }
        }
        return null;
    }
}
